package require Mk4tcl

mk::file open ndb docs/wubchain.tkd.new
mk::view size ndb.users 0
mk::view layout ndb.users {
    username 
    password 
    email 
    sid 
    last_login:I 
    emoticons:I 
    nick_colors:I
    lines:I 
    auto_update:I 
    user_list:I
    mobile:I 
    from_language 
    to_language 
    time_stamps:I 
    time_zone 
    hide_logon_logoff:I
    admin:I
    state
    {subjects {
	id:I subject
    }}
}

mk::file open odb docs/wubchain.tkd

mk::loop i odb.users {
    set d [dict create {*}[mk::get $i]]
    puts $d
    set d [dict set d username [string tolower [dict get $d username]]]
    puts $d
    mk::row append ndb.users {*}$d
}

mk::file commit ndb

mk::file close ndb
mk::file close odb
exit
